import { Component, OnInit } from '@angular/core';
import {ActivatedRoute} from "@angular/router"; //这样能接收url中参数

@Component({
  selector: 'app-newscontent',
  templateUrl: './newscontent.component.html',
  styleUrls: ['./newscontent.component.css']
})
export class NewscontentComponent implements OnInit {

  constructor(private route:ActivatedRoute) {//实例化动态路由模块

  }

  ngOnInit(): void {
   this.route.params.subscribe(function (data){//获取动态路由
      console.log(data)
    })
  }

}
